/**
 * \file token.h
 * \brief An interface between the packrat parser and the lexer (either lex.c
 * or anything else that generates these structures).
 **/

#ifndef R_TOKEN_H
#define R_TOKEN_H

#include "standard.h"
#include "chunk.h"
#include "vector.h"

/**
 * \brief A single token in the token list.
 **/
struct RTokenT {
  uint32_t type; /*< Application defined "type" of the token.
                  *  May be anything but 0. */
  void* extra; /*< Application defined pointer to anything. */
};
typedef struct RTokenT RToken;

/**
 * \brief End of input token.
 **/
#define R_END_TOKEN 0

/**
 * \brief Add a token to the list.
 **/
void r_tok_list_add(RVector* list, uint32_t type, void* extra);

/**
 * \brief Get a token at idx in the list.
 **/
RToken r_tok_list_get(RVector* list, uint32_t idx);

/**
 * \brief Initialize a token list inside a RVector.
 **/
void r_tok_list_init(RVector* vector);

#endif /* R_TOKEN_H */
